home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_203 / examples / samp / tosamp.asm < prev   
Assembly Source File  |  1992-05-06  |  32KB  |  1,121 lines

  1.  ;Assembled with Innovatronic's CAPE assembler with the SMALLOBJ directive.
  2.  ;(i.e. PC relative code) For other assemblers, uncomment the section
  3.  ;directive before the data section.
  4.  ;Link as follows
  5.  ;Blink SmallStart.o ToSAMP.o small.lib NODEBUG to ToSAMP
  6.  ;where SmallStart.o is the startup code included with this program and
  7.  ;small.lib is Bryce Nesbitt's amiga lib.
  8.  ;For Manx,
  9.  ;as -cd -o ToSAMP ManxStartUp.o ToSAMP.o -lcl32
  10.  ;
  11.  ; This example uses R.J. Mical's FileIO requester in a special library form
  12.  ; prepared by
  13.  ;                           dissidents
  14.  
  15.   SMALLOBJ
  16.  
  17.   INCLUDE  "FileIO.i" ;requires RJ Mical's FileIO in library form
  18.  
  19.          SECTION  ToSampCode,CODE
  20.  
  21.    XREF  _DOSBase,_SysBase ;from StartUp code
  22.  
  23.    XREF  _LVOOpenLibrary,_LVOCloseLibrary,_LVOOpenWindow,_LVOCloseWindow
  24.    XREF  _LVOAllocMem,_LVOFreeMem
  25.    XREF  _LVOGetMsg,_LVOReplyMsg,_LVOWait,_LVOWaitPort
  26.    XREF  _LVOPrintIText,_LVODrawImage
  27.    XREF  _LVOMove,_LVOText,_LVOSetAPen
  28.    XREF  _LVOOpen,_LVORead,_LVOWrite,_LVOClose,_LVODelay
  29.    XREF  _LVOLock,_LVOUnLock,_LVOExamine,_LVODeleteFile
  30.  
  31. MODE_OLDFILE equ 1005
  32. MODE_NEWFILE equ 1006
  33. LIB_VERSION  equ 33
  34.  
  35.    XDEF print_type
  36. print_type:
  37.     bsr.s   blank
  38.     moveq   #0,d0
  39.     move.b  d5,d0
  40.     add.b   d0,d0
  41.     add.b   d0,d0
  42.     lea     TYPES,a0
  43.     adda.l  d0,a0
  44.     move.l  (a0),a4
  45.     moveq   #0,d2
  46.     move.b  (a4)+,d2
  47.     move.b  d2,NumOfChoices
  48.     moveq   #10,d3
  49.     moveq   #10,d4
  50. mgg moveq   #26,d0
  51.     add.w   d3,d4
  52.     move.w  d4,d1
  53.     bsr.s   print_msg  ;returns end of msg (beginning of next string)
  54.     Dbra    d2,mgg
  55.     rts
  56.  
  57. blank:
  58.    moveq   #17-1,d2
  59.    moveq   #10,d3
  60.    moveq   #10,d4
  61. mG lea     SPACES,a4
  62.    moveq   #26,d0
  63.    add.w   d3,d4
  64.    move.w  d4,d1
  65.    bsr.s   print_msg
  66.    Dbra    d2,mG
  67.    rts
  68.  
  69.   XDEF print_msg  ;string passed in a4, x in d0, y in d1
  70. print_msg:
  71.     movea.l   RastPort,a2
  72.     movea.l   a2,a1
  73.     movea.l   _GfxBase,a6
  74.     jsr       _LVOMove(a6)
  75.     movea.l   a4,a0
  76. len move.b    (a4)+,d0
  77.     bne.s     len
  78.     move.l    a4,d0
  79.     subq.l    #1,d0
  80.     sub.l     a0,d0           ;length of string
  81.     movea.l   a2,a1           ;RastPort
  82.     jmp       _LVOText(a6)
  83.  
  84.    XDEF print_directions
  85. print_directions:
  86.    lea     Directions,a4
  87.    lea     Positions,a5
  88.    moveq   #10-1,d2
  89.    moveq   #10,d3
  90.    moveq   #10,d4
  91. mg move.w  (a5)+,d0
  92.    add.w   d3,d4
  93.    move.w  d4,d1
  94.    bsr.s   print_msg  ;returns end of msg (beginning of next string)
  95.    Dbra    d2,mg
  96.    rts
  97.  
  98.    XDEF print_family
  99. print_family:
  100.    bsr     blank
  101.    lea     Family,a4
  102.    moveq   #17-1,d2
  103.    moveq   #10,d3
  104.    moveq   #10,d4
  105. MG moveq   #26,d0
  106.    add.w   d3,d4
  107.    move.w  d4,d1
  108.    bsr.s   print_msg  ;returns end of msg (beginning of next string)
  109.    Dbra    d2,MG
  110.    rts
  111.  
  112. Positions dc.w 38,28,38,26,30,39,29,24,30,84
  113.  
  114.    XDEF _main
  115. _main:
  116. ;---Open Gfx Library
  117.         movea.l  _SysBase,a6
  118.         moveq    #LIB_VERSION,d0
  119.         lea      GfxName,a1
  120.         jsr      _LVOOpenLibrary(a6)
  121.         move.l   d0,_GfxBase
  122.         bne.s    xx
  123.         rts
  124. ;---Open Intuition
  125. xx      moveq    #LIB_VERSION,d0
  126.         lea      IntuitionName,a1
  127.         jsr      _LVOOpenLibrary(a6)
  128.         move.l   d0,_IntuitionBase
  129.         beq      clG
  130. ;---Open the main window
  131.         lea      newWindow,a0
  132.         move.l   a6,-(sp)
  133.         movea.l  d0,a6
  134.         jsr      _LVOOpenWindow(a6)
  135.         movea.l  (sp)+,a6
  136.         move.l   d0,WindowPtr
  137.         beq      clI
  138.         move.l   d0,a0
  139.         move.l   50(a0),RastPort
  140.   ;---Open the FileIO (requester) library
  141.         moveq     #0,d0            ;any version (for now)
  142.         lea       RequesterName,a1
  143.         jsr       _LVOOpenLibrary(a6)
  144.         move.l    d0,_RequesterBase
  145.         bne.s     gotit
  146.          ;---error
  147.         lea       FileReqErr,a4
  148.         moveq     #5,d0
  149.         moveq     #75,d1
  150.         bsr       print_msg
  151.         moveq     #100,d1
  152.         movea.l   _DOSBase,a6
  153.         jsr       _LVODelay(a6)
  154.         bra       clW
  155. ;===================Get the FileIO Structure========================
  156. gotit   movea.l   d0,a6
  157.         jsr       _LVOGetFileIO(a6)
  158.         move.l    d0,FileIO
  159.         bne.s     gotIO
  160.         lea       IOerR,a4
  161.         moveq     #5,d0
  162.         moveq     #75,d1 
  163.         bsr       print_msg
  164.         moveq     #100,d1
  165.         movea.l   _DOSBase,a6
  166.         jsr       _LVODelay(a6)
  167.         bra       clF
  168.   ;---Set up info file suppression
  169. gotIO   movea.l   d0,a0
  170.         Bset.b    #INFO_SUPPRESS,1(a0)  ;INFO_SUPPRESS ON
  171.   ;--Set up the XY co-ordinates of where the requester will open
  172.   ; If we used DoFileIOWindow(), we wouldn't need to set co-ordinates.
  173.         moveq     #6,d0
  174.         move.w    d0,FILEIO_X(a0)  ;x position
  175.         moveq     #11,d0
  176.         move.w    d0,FILEIO_Y(a0)  ;y position
  177.   ;---Setup buffer for path name
  178.         lea       _BUFFER,a1
  179.         move.l    a1,FILEIO_BUFFER(a0)
  180.         moveq     #1,d0
  181.         move.b    d0,FILEIO_DRAWMODE(a0)
  182.         move.b    d0,FILEIO_PENA(a0)
  183. ;====Create a mask of the Window's UserPort's mp_Sigbit=====
  184.         movea.l   WindowPtr,a3
  185.         movea.l   86(a3),a0
  186.         move.b    15(a0),d0
  187.         moveq     #0,d7
  188.         Bset.l    d0,d7
  189. ;----Print out Directions
  190.         bsr       print_directions
  191. ;********************** MAIN LOOP ******************************
  192. ;=====Get the message that arrived at our UserPort====
  193. E4     movea.l   86(a3),a0
  194.        movea.l   _SysBase,a6
  195.        jsr       _LVOGetMsg(a6)
  196.        move.l    d0,d1
  197.        bne.s     E7
  198. ;===Check if we are ready to exit the program=====
  199.        Btst.b    #0,Quit
  200.        beq       delFile
  201. ;===Wait for a message sent to our Window (from Intuition)===
  202.        move.l    d7,d0
  203.        jsr       _LVOWait(a6)
  204.        bra.s     E4
  205. ;====Copy all the info we want from the IntuiMessage====
  206. E7    movea.l   d0,a1
  207.       lea       20(a1),a0  ;get the address of the first field to copy.
  208.       move.l    (a0)+,d6   ;Copy the Class field to d6
  209.       move.w    (a0)+,d5   ;Copy the Code field to d5
  210.       move.w    (a0)+,d4   ;Copy the qualifier field to d4
  211.       movea.l   (a0)+,a2   ;Copy the IAddress field to a2
  212.       move.w    (a0)+,d3   ;Copy MouseX position to d3
  213.       move.w    (a0)+,d2   ;Copy MouseY position to d2
  214. ;====Now reply to the message so Intuition can dispose of it
  215. E8  ;Address of the message is in a1.
  216.       jsr       _LVOReplyMsg(a6)
  217. ;========switch (class)=========
  218.       Bclr.l    #3,d6  ;MOUSEBUTTONS
  219.       bne.s     GADG
  220.       Bclr.l    #9,d6  ;CLOSEWINDOW
  221.       beq.s     E4
  222. ;=========case CLOSEWINDOW:============
  223. CW    Bclr.b    #0,Quit
  224.       bra.s     E4
  225. ;---Make sure that it's an UP select if MOUSEBUTTONS
  226. GADG  subi.b    #$68,d5
  227.       beq       E4     ;ignore down
  228.      ;---get the user's filename and load the 8SVX file
  229. E2    bsr       load_8SVX
  230.       subq.b    #1,d0
  231.       bne.s     Cerr
  232.      ;---Convert the file to SAMP and save
  233.       bsr       convert_8SVX
  234.       subq.b    #1,d0
  235.       bne.s     Cerr
  236.      ;---Indicate a successful conversion
  237.       lea       Success,a4
  238.   ;---delete the 8SVX conversion buffer if it exists
  239. Cerr  bsr       free_data
  240.   ;---Print the returned message
  241.       movea.l   _RequesterBase,a6
  242.       movea.l   a3,a0
  243.       move.l    a4,d0
  244.       jsr       _LVOAutoMessage(a6)
  245.       movea.l   _SysBase,a6
  246. ep    movea.l   86(a3),a0
  247.       jsr       _LVOGetMsg(a6)
  248.       move.l    d0,d1
  249.       bne.s     ep
  250. ;******************** Exit the Program *********************
  251.      ;If the pointer to FileIO was NULL, then
  252.      ;ReleaseFileIO just returns, so it's safe to
  253.      ;always release any return value of GetFileIO.
  254. delFile  movea.l  FileIO,a1
  255.          movea.l  _RequesterBase,a6
  256.          jsr      _LVOReleaseFileIO(a6)
  257.     ;---Close the graphics lib
  258. clF      movea.l  _RequesterBase,a1
  259.          movea.l  _SysBase,a6
  260.          jsr      _LVOCloseLibrary(a6)
  261.     ;---Close the window
  262. clW      movea.l  WindowPtr,a0
  263.          movea.l  _IntuitionBase,a6
  264.          jsr      _LVOCloseWindow(a6)
  265.     ;---Close the Intuition Lib
  266. clI      movea.l  _SysBase,a6
  267.          movea.l  _IntuitionBase,a1
  268.          jsr      _LVOCloseLibrary(a6)
  269.     ;---Close the graphics lib
  270. clG      movea.l  _GfxBase,a1
  271.          jmp      _LVOCloseLibrary(a6)
  272.  
  273.   XDEF load_8SVX
  274. load_8SVX:
  275.        movem.l  d2/d3/d4/d5,-(sp)
  276.  ;---Get the user's filename via the FileIO requester
  277.        movea.l  WindowPtr,a1
  278.        movea.l  FileIO,a0
  279.        movea.l  _RequesterBase,a6
  280.        jsr      _LVODoFileIO(a6)
  281.        move.l   d0,d1
  282.        bne.s    L92    ;If 0, must have been an error
  283.        lea      LibErr,a4
  284. outL   movem.l  (sp)+,d2/d3/d4/d5
  285.        rts
  286. L92    addq.l   #1,d0
  287.        bne.s    L90
  288.     ;If -1, user must have selected CANCEL
  289.        lea      Cancel,a4
  290.        bra.s    outL
  291.    ;---Get the File's Size
  292. L90    movea.l   FileIO,a0
  293.        move.l    FILEIO_FILESIZE(a0),d0
  294.        move.l    d0,FileSize
  295.        bne.s     L89
  296.        ;---If size = 0, then this file must not exist (in this directory)
  297. L95    lea       CantFind,a4
  298.        bra.s     outL
  299.    ;---get a conversion buffer to copy in the entire 8SVX file
  300. L89    movea.l   _SysBase,a6
  301.        moveq     #1,d1
  302.        jsr       _LVOAllocMem(a6)
  303.        move.l    d0,_8SVXData   ;the address of conversion buffer
  304.        bne.s     L93
  305.        move.l    d0,FileSize    ;size of conversion buffer
  306.        lea       NoMem,a4
  307.        bra.s     outL
  308.    ;---Open the file
  309. L93    moveq     #0,d2
  310.        move.w    #MODE_OLDFILE,d2
  311.        lea       _BUFFER,a0
  312.        move.l    a0,d1
  313.        movea.l   _DOSBase,a6
  314.        jsr       _LVOOpen(a6)
  315.        move.l    d0,d4
  316.        beq.s     L95
  317.    ;---Make sure that this is an 8SVX file
  318.        moveq     #20,d3     ;read the first 20 bytes
  319.        move.l    _8SVXData,d2
  320.        move.l    d4,d1
  321.        jsr       _LVORead(a6)
  322.        sub.l     d0,d3
  323.        bne.s     CloseR
  324.        movea.l   _8SVXData,a0
  325.        addq.l    #8,a0
  326.        move.l    _8SVX,d0
  327.        sub.l     (a0),d0
  328.        beq.s     readin
  329.        ;---Not 8SVX
  330. NotIFF move.l    d4,d1
  331.        jsr       _LVOClose(a6)
  332.        moveq     #0,d0
  333.        lea       Not8SVX,a4
  334.        bra       outL
  335.    ;---Read in the rest of the file (starting with VHDR's oneShotHiSamples)
  336. readin move.l    FileSize,d3
  337.        moveq     #20,d0
  338.        sub.l     d0,d3
  339.        move.l    _8SVXData,d2 
  340.        move.l    d4,d1
  341.        jsr       _LVORead(a6)
  342.        sub.l     d0,d3
  343. CloseR move.l    d4,d1
  344.        jsr       _LVOClose(a6)
  345.        moveq     #1,d0
  346.        move.l    d3,d1
  347.        beq       outL
  348.        lea       ReadErr,a4
  349.        moveq     #0,d0
  350.        bra       outL
  351.  
  352. ; This frees the conversion buffer when we are done with it.
  353.  
  354.   XDEF free_data
  355. free_data:
  356.      lea     _8SVXData,a0
  357.      move.l  (a0),d0
  358.      beq.s   no8D
  359.      clr.l   (a0)+
  360.      movea.l d0,a1
  361.      move.l  (a0),d0  ;FileSize
  362.      clr.l   (a0)
  363.      movea.l _SysBase,a6
  364.      jmp     _LVOFreeMem(a6)
  365. no8D move.l  d0,4(a0)
  366.      rts
  367.  
  368.    XDEF divide
  369.  ;This routine divides 2 LONGS passed in d0 and d1.
  370.  ;d0 = d0/d1 with d2 = the remainder.
  371. divide:
  372.     moveq   #0,d2
  373.     moveq   #31,d3
  374. _1  asl.l   #1,d0
  375.     roxl.l  #1,d2
  376.     cmp.l   d1,d2
  377.     bcs.s   _2
  378.     sub.l   d1,d2
  379.     addq.l  #1,d0
  380. _2  Dbra    d3,_1
  381.     rts
  382.  
  383.    XDEF convert_8SVX
  384. convert_8SVX:
  385.      movem.l  d2/d3/d4/d5/a3/a4,-(sp)
  386.   ;---Make the SAMP playMap. Assign each interpolation an octave in the map
  387.      movea.l  _8SVXData,a4
  388.      lea      playMap,a1
  389.      moveq    #0,d0
  390.      move.b   14(a4),d0  ;the number of octaves in the 8SVX file
  391.      beq      CCC
  392.   ;---limit to 10 octaves of the 8SVX file (numbered 1 to 10)
  393.      moveq    #10,d1
  394.      cmp.b    d1,d0
  395.      bls.s    okOT
  396.      move.b   d1,d0
  397. okOT move.b   d0,numOfWaves
  398. nto  moveq    #12-1,d1  ;1 octave of notes
  399. octt move.b   d0,(a1)+
  400.      move.b   d0,(a1)+
  401.      move.b   d0,(a1)+
  402.      move.b   d0,(a1)+
  403.      Dbra     d1,octt
  404.      subq.b   #1,d0
  405.      bne.s    nto
  406.   ;---Store the sampleRate
  407.      move.w   12(a4),d1  ;samplesPerSec
  408.      beq.s    def
  409.      move.l   d1,sampleRate
  410.      ;---calculate samplePeriod
  411.      move.l   #1000000000,d0 ;in nanoseconds
  412.      bsr.s    divide
  413.      move.l   d0,samplePeriod
  414. def  lea      20(a4),a0      ;the chunk after VHDR
  415. ;================PROCESS AN 8SVX CHUNK================
  416. nChk bsr      DoWeWantIt
  417.      beq      BodyHandler ;the last chunk in 8SVX
  418.      subq.b   #1,d0
  419.      beq.s    DoName
  420.      subq.b   #1,d0
  421.      beq      DoATAK
  422.      subq.b   #1,d0
  423.      beq      DoRLSE
  424.    ;---Throw away this chunk
  425. thrw move.l   4(a0),d0 ;chunk size
  426.      Btst.l   #0,d0
  427.      beq.s    even
  428.      addq.l   #1,d0
  429. even addq.l   #8,a0
  430.      adda.l   d0,a0    ;skip to the end of the chunk
  431.      bra.s    nChk
  432. ;--'NAME': Copy the "Master" name to name buffer and count # of chars
  433. ;  including NULL (+1 to append the wave number). Calculate the final
  434. ;  resulting chunk size. Make sure that the name is an even # of bytes.
  435. DoName:
  436.      lea      name,a1
  437.      moveq    #19-1,d0 ;copy 19 chars (including NULL) Max
  438.      movea.l  a0,a3
  439.      addq.l   #8,a3
  440.      move.l   a1,d1
  441. cnm  move.b   (a3)+,(a1)+
  442.      Dbeq     d0,cnm
  443.      move.l   a1,d0
  444.      clr.b    -(a1)
  445.      sub.l    d1,d0  ;length of 1 wave name counting NULL
  446.      addq.l   #1,d0  ;allow for appending the wave (octave) number
  447.      Btst.l   #0,d0
  448.      beq.s    EVEN
  449.      addq.l   #1,d0
  450.      move.b   #' ',(a1)+
  451. EVEN move.l   a1,nameNULL
  452.      moveq    #0,d1
  453.      move.b   numOfWaves,d1
  454.      mulu.w   d1,d0     
  455.      move.l   d0,nameSize
  456.      bra.s    thrw
  457. ;---Note the address and size (bytes) of the ATAK chunk. We'll copy it to
  458. ;   disc verbatim...once for each wave.
  459. DoATAK:
  460.      movea.l  a0,a3
  461.      addq.l   #4,a3
  462.      move.l   (a3)+,d0
  463.      move.l   d0,sizeOfATAK ;This should always be even.
  464.      move.l   a3,ATAKptr    ;addr of EGpoints[]
  465.    ;---add the (size of chunk) x numOfWaves to sizeOfBODY
  466. sze  moveq    #0,d1
  467.      move.b   numOfWaves,d1
  468.      mulu.w   d1,d0        ;should actually be a LONG multiply just in case!
  469.      add.l    d0,sizeOfBODY
  470.      bra.s    thrw
  471. DoRLSE:
  472.      movea.l  a0,a3
  473.      addq.l   #4,a3
  474.      move.l   a3,RLSEptr  ;addr of sizeOfRLSE
  475.      move.l   (a3)+,d0
  476.      move.l   d0,sizeOfRLSE
  477.      bra.s    sze
  478. ;================== BODY ==========================
  479. BodyHandler:
  480.  ;===Calculate size of BODY and total size of all chunks
  481.      addq.l   #8,a0       ;get beginning of sample data
  482.      lea      SampleInfo0,a3
  483.      move.b   numOfWaves,d0
  484.      subq.b   #1,d0
  485.      move.l   (a4),d4  ;oneShotHiSamples
  486.      move.l   4(a4),d5 ;repeatHiSamples
  487.      move.l   a0,(a3)+
  488.      move.l   d4,(a3)+
  489.      move.l   d4,d1
  490.      add.l    d5,d1    ;total size of this wave
  491.      move.l   d1,d2    ;store sum of all wave sizes in d2
  492.      moveq    #80,d3   ;80 byte waveHeader in BODY for each wave
  493.      bra.s    _1o
  494.   ;---Store one wave's waveHeader
  495. agns move.l   a0,(a3)+ ;start address of sample data
  496.      lsl.l    #1,d4    ;2x oneShot size
  497.      move.l   d4,(a3)+ ;size of oneShot (also loopStart offset)
  498.      lsl.l    #1,d5    ;size of loop portion
  499.      move.l   d5,d1
  500.      add.l    d4,d1
  501.      add.l    d1,d2
  502. _1o  add.l    d3,d2    ;add size of waveHeader
  503.      move.l   d1,(a3)+ ;loopEnd offset (also this wave's waveSize)
  504.      adda.l   d1,a0    ;next wave
  505.      Dbra     d0,agns
  506.      add.l    d2,sizeOfBODY
  507.   ;---calculate the total size of ALL chunks in the SAMP file
  508.      move.l   nameSize,d0
  509.      beq.s    noNh
  510.      addq.l   #8,d0    ;add 8 bytes for NAME header
  511. noNh add.l    sizeOfBODY,d0
  512.      add.l    d0,sizeOfChunks
  513. ;============== ASK THE USER TO DETERMINE THE INSTRUMENT TYPE =============
  514.   ;---Determine the family
  515.      bsr       print_family
  516.      movea.l   _SysBase,a6
  517. fam  move.l    d7,d0
  518.      jsr       _LVOWait(a6)
  519.      movea.l   WindowPtr,a1
  520.      movea.l   86(a1),a0
  521.      jsr       _LVOGetMsg(a6)
  522.      move.l    d0,d1
  523.      beq.s     fam
  524.      movea.l   d0,a1
  525.      lea       20(a1),a0  ;get the address of the first field to copy.
  526.      move.l    (a0)+,d2   ;Copy the Class field
  527.      move.w    (a0)+,d5   ;Copy the Code field to d5
  528.    ;Address of the message is in a1.
  529.      jsr       _LVOReplyMsg(a6)
  530.    ;---wait for rawkey
  531.      Bclr.l    #10,d2 ;RAWKEY
  532.      beq.s     fam
  533.    ;---Decode rawkey into Family nibble
  534.      Bclr.l    #7,d5
  535.      bne.s     fam    ;key up
  536.      Btst.l    #5,d5
  537.      beq.s     row1
  538.      moveq     #22,d1
  539.      sub.b     d1,d5
  540.      bcs.s     unkn
  541.      cmpi.b    #14,d5
  542.      bcc.s     unkn
  543.      bra.s     gtyp
  544. row1 moveq     #16,d1
  545.      sub.b     d1,d5
  546.      bcs.s     unkn
  547.      cmpi.b    #10,d5
  548.      bcc.s     unkn
  549. gtyp bsr       print_type
  550.      addq.b    #1,d5
  551. type move.l    d7,d0
  552.      movea.l   _SysBase,a6
  553.      jsr       _LVOWait(a6)
  554.      movea.l   WindowPtr,a1
  555.      movea.l   86(a1),a0
  556.      jsr       _LVOGetMsg(a6)
  557.      move.l    d0,d1
  558.      beq.s     type
  559.      movea.l   d0,a1
  560.      lea       20(a1),a0  ;get the address of the first field to copy.
  561.      move.l    (a0)+,d2   ;Copy the Class field
  562.      move.w    (a0)+,d3   ;Copy the Code field to d3
  563.    ;Address of the message is in a1.
  564.      jsr       _LVOReplyMsg(a6)
  565.    ;---wait for rawkey
  566.      Bclr.l    #10,d2 ;RAWKEY
  567.      beq.s     type
  568.      Bclr.l    #7,d3
  569.      bne.s     type    ;key up
  570.    ;---Decode rawkey into Type nibble
  571.      Btst.l    #5,d3
  572.      beq.s     roW1
  573.      moveq     #22,d1
  574.      sub.b     d1,d3
  575.      bcs.s     unkn
  576.      bra.s     gtby
  577. roW1 moveq     #16,d1
  578.      sub.b     d1,d3
  579.      bcs.s     unkn
  580.      cmpi.b    #10,d3
  581.      bcc.s     unkn
  582. gtby cmp.b     NumOfChoices,d3
  583.      bhi.s     unkn
  584.      addq.b    #1,d3
  585.      lsl.b     #4,d3
  586.      or.b      d3,d5
  587.      move.b    d5,Itype
  588.   ;---Ask user if he wants to save to the same Filename with .SAMP extention
  589. unkn lea      _BUFFER,a0
  590.      lea      SAMPext,a1
  591.      movem.l  a2/a3,-(sp)
  592.      bsr      appendstr
  593.      movea.l  _RequesterBase,a6
  594.      movea.l  WindowPtr,a0
  595.      lea      _BUFFER,a2
  596.      lea      Same,a1
  597.      suba.l   a3,a3
  598.      jsr      _LVOAutoPrompt3(a6)
  599.      movem.l  (sp)+,a2/a3
  600.      move.b   d0,d1
  601.      bne.s    sav
  602.   ;---Get a new name via the FileIO lib
  603.   ;-----DoFileIO(FileIO, window)
  604.      movea.l  WindowPtr,a1
  605.      movea.l  FileIO,a0
  606.      jsr      _LVODoFileIO(a6)
  607.      addq.l   #1,d0
  608.      bne.s    sav
  609.     ;If -1, user must have selected CANCEL. Abort the Conversion.
  610.      lea      Cancel,a4
  611. outS movem.l  (sp)+,d2/d3/d4/d5/a3/a4
  612.      rts
  613.   ;---Create this file
  614. sav  lea      _BUFFER,a0
  615.      movea.l  _DOSBase,a6
  616.      move.l   a0,d1
  617.      moveq    #0,d2
  618.      move.w   #MODE_NEWFILE,d2
  619.      jsr      _LVOOpen(a6)
  620.      move.l   d0,d4
  621.      bne.s    fh
  622.     ;---error
  623. CCC  lea      CantCreate,a4
  624.      bra.s    outS
  625.    ;---Write SAMP and MHDR chunks, and the 8 byte NAME header (if it exists)
  626. fh   move.l   #516+8+8,d3
  627.      move.l   nameSize,d2
  628.      beq.s    nNH
  629.      addq.l   #8,d3
  630. nNH  lea      SAMP,a0
  631.      move.l   a0,d2
  632.      move.l   d4,d1
  633.      jsr      _LVOWrite(a6)
  634.      sub.l    d0,d3
  635.      beq.s    wwOK
  636.     ;--WRITE error
  637. WE   move.l   d4,d1
  638.      jsr      _LVOClose(a6)
  639.      lea      _BUFFER,a0
  640.      move.l   a0,d1
  641.      jsr      _LVODeleteFile(a6)
  642.      lea      WriteErr,a4
  643.      moveq    #0,d0
  644.      bra.s    outS
  645.   ;---Write the NAME chunk (if nameSize is not 0)
  646. wwOK move.l   nameSize,d0
  647.      beq.s    WrOK
  648.      moveq    #0,d5
  649.      move.b   numOfWaves,d5
  650.      subq.b   #1,d5
  651.      ;---append the wave number each time that we write out the name
  652. nnnn movea.l  nameNULL,a0
  653.      move.b   d5,d1
  654.      addi.b   #'0',d1
  655.      move.b   d1,(a0)+
  656.      clr.b    (a0)+
  657.      lea      name,a1
  658.      move.l   a1,d2
  659.      suba.l   a1,a0
  660.      move.l   a0,d3
  661.      move.l   d4,d1
  662.      jsr      _LVOWrite(a6)
  663.      sub.l    d0,d3
  664.      bne.s    WE
  665.      Dbra     d5,nnnn
  666.   ;---Save the 8 byte BODY header
  667. WrOK lea      BODY,a0
  668.      moveq    #8,d3
  669.      move.l   a0,d2
  670.      move.l   d4,d1
  671.      jsr      _LVOWrite(a6)
  672.      sub.l    d0,d3
  673.      bne.s    WE
  674. ;********** SAVE WAVES (80 byte waveHeader and data for each wave) *********
  675.      lea      SampleInfo0,a3
  676.      moveq    #0,d5
  677.      move.b   numOfWaves,d5
  678.      moveq    #12,d0
  679.      mulu.w   d5,d0
  680.      addq.b   #6,d0
  681.      move.b   d0,rootNote  ;set the rootNote for the highest octave
  682.      subq.b   #1,d5
  683. ;================ SAVE 1 WAVE =====================
  684. savesam:
  685.   ;---Store BODY parameters for this wave
  686.      lea      waveSize,a0
  687.      move.l   8(a3),(a0)+ ;store loopEnd in waveSize
  688.      addq.w   #1,(a0)     ;inc midiSampNum
  689.      addq.l   #8,a0
  690.      addq.l   #4,a0
  691.      move.l   4(a3),(a0)+ ;store loopStart
  692.      move.l   8(a3),(a0)+ ;store loopEnd
  693.      subi.b   #12,(a0)    ;dec to middle of previous octave
  694.   ;---Write the 80 byte waveHeader
  695.      moveq    #80,d3
  696.      lea      waveHeader,a0
  697.      move.l   a0,d2
  698.      move.l   d4,d1
  699.      jsr      _LVOWrite(a6)
  700.      sub.l    d0,d3
  701.      bne      WE
  702.   ;---see if there are ATAK EgPoints to write
  703.      move.l   ATAKptr,d2
  704.      beq.s    noAT
  705.      move.l   sizeOfATAK,d3
  706.      move.l   d4,d1
  707.      jsr      _LVOWrite(a6)
  708.      sub.l    d0,d3
  709.      bne      WE
  710.   ;---Write any RLSE EgPoints
  711. noAT move.l   RLSEptr,d2
  712.      beq.s    noRT
  713.      move.l   sizeOfRLSE,d3
  714.      move.l   d4,d1
  715.      jsr      _LVOWrite(a6)
  716.      sub.l    d0,d3
  717.      bne      WE
  718.   ;---write the wave's data
  719. noRT move.l   (a3)+,d2
  720.      move.l   d4,d1
  721.      addq.l   #4,a3
  722.      move.l   (a3)+,d3
  723.      jsr      _LVOWrite(a6)
  724.      sub.l    d0,d3
  725.      bne      WE
  726.   ;---do the next wave
  727.      Dbra     d5,savesam
  728.   ;---close the file and return success
  729.      move.l   d4,d1
  730.      jsr      _LVOClose(a6)
  731.      moveq    #1,d0
  732.      bra      outS
  733.  
  734.   XDEF appendstr
  735. appendstr:
  736.      move.b  (a0)+,d1
  737.      bne.s   appendstr
  738.      subq.l  #1,a0
  739. appp move.b  (a1)+,(a0)+
  740.      bne.s   appp
  741.      rts
  742.  
  743.    XDEF DoWeWantIt
  744. DoWeWantIt:
  745.     move.l  (a0),d0
  746.     cmp.l   NAME,d0
  747.     beq.s   itsNAME
  748.     cmp.l   ATAK,d0
  749.     beq.s   itsATAK
  750.     cmp.l   RLSE,d0
  751.     beq.s   itsRLSE
  752.     sub.l   BODY,d0
  753.     bne.s   unKn
  754.     rts
  755. itsNAME:
  756.     moveq   #1,d0
  757.     rts
  758. itsATAK:
  759.     moveq   #2,d0
  760.     rts
  761. itsRLSE:
  762.     moveq   #3,d0
  763.     rts
  764. unKn:
  765.     moveq   #-1,d0
  766.     rts
  767.  
  768.     ; SECTION ToSAMPData,Data   ;UnComment if not using CAPE
  769.  
  770.    XDEF   newWindow
  771. newWindow:
  772.           dc.w   0,0
  773.           dc.w   640,200
  774.           dc.b   0,1
  775.  ;IDCMP = MOUSEBUTTONS|CLOSEWINDOW|RAWKEY
  776.           dc.l   $608
  777. ;WindowFlags = WINDOWCLOSE|WINDOWDEPTH|SMART_REFRESH|ACTIVATE (no FOLLOWMOUSE
  778. ;allowed as that messes up the requester when using DoFileIO(). If you need
  779. ;FOLLOWMOUSE, then use DoFileIOWindow() to open the req in its own window.)
  780.           dc.l   $100C
  781.           dc.l   0
  782.           dc.l   0
  783.           dc.l   WINTITLE
  784. ScreenPtr dc.l   0
  785.           dc.l   0
  786.           dc.w   96,30
  787.           dc.w   320,200
  788.           dc.w   1         ;WBENCHSCREEN
  789.  
  790. TextAttr:        ;Topaz 8 is a ROM font so doesn't need to be opened
  791.    dc.l   FONTNAME
  792.    dc.w   8      ;TOPAZ_EIGHTY
  793.    dc.b   0,0
  794.  
  795.   XDEF _GfxBase,_IntuitionBase,_RequesterBase,WindowPtr,RastPort
  796.   XDEF _8SVXData,FileSize,FileIO,RequesterName,nameNULL,name,nameSize,NAME
  797.  
  798. _GfxBase       dc.l  0
  799. _IntuitionBase dc.l  0
  800. _RequesterBase dc.l  0
  801. WindowPtr      dc.l  0
  802. RastPort       dc.l  0
  803. _8SVXData      dc.l  0
  804. FileSize       dc.l  0
  805. FileIO         dc.l  0
  806.  
  807. ATAK      dc.b  'ATAK'
  808. RLSE      dc.b  'RLSE'
  809. _8SVX     dc.b  '8SVXVHDR'
  810. nameNULL  dc.l  name
  811. name      ds.b  20    ;buffer for the NAME chunk
  812.  
  813.    XDEF SAMP,sizeOfChunks,MHDR,sizeOfMHDR,playMap,numOfWaves,BODY,sizeOfBODY
  814.    XDEF name,waveSize,midiSampNum,loopType,sampleRate,samplePeriod
  815.    XDEF loopStartPoint,loopEndPoint,rootNote,sizeOfATAK,ATAKptr,RLSEptr
  816.    XDEF sizeOfRLSE,SampleInfo0,sizeOfFATK
  817.  
  818. ;===================== SAMP PORTION ==========================
  819. SAMP           dc.b 'SAMP'
  820. sizeOfChunks   dc.l 516+8+8 ;MHDR size + MHDR Header + BODY Header (add
  821.                             ;sizeOfBODY, nameSize, other chunks size)
  822. ;------------------------------
  823. MHDR           dc.b 'MHDR'
  824. sizeOfMHDR     dc.l 516
  825. playMap        ds.l 128 ;4 bytes for each of 128 midi notes
  826. numOfWaves     dc.b 0
  827. sampleFormat   dc.b 8
  828. Flags          dc.b 0
  829. playMode       dc.b 1   ;MULTI default
  830.  
  831. NAME           dc.b 'NAME'
  832. nameSize       dc.l 0
  833.  
  834. ;------------------------------
  835. BODY           dc.b 'BODY'
  836. sizeOfBODY     dc.l 0 ;add size of ATAK, RLSE, waveSize, and 80 bytes
  837.                       ;(for each wave's header)
  838.   ;for each wave, store these 80 bytes
  839. waveHeader:
  840. waveSize       dc.l 0
  841. midiSampNum    dc.w -1    ;inc for each wave
  842. loopType       dc.b 0     ;forward
  843. Itype          dc.b 0     ;unKnown
  844. samplePeriod   dc.l 55556 ;ditto
  845. sampleRate     dc.l 18000 ;assume some default 
  846. loopStartPoint dc.l 0
  847. loopEndPoint   dc.l 0
  848. rootNote       dc.b 0     ;set to the note # in middle of each octave (i.e.
  849.                           ;note number = 6 for the lowest octave)
  850. velocityStart  dc.b 0
  851. velStartTable  ds.w 16
  852. sizeOfATAK     dc.l 0
  853. sizeOfRLSE     dc.l 0
  854. sizeOfFATK     dc.l 0
  855. sizeOfFRLS     dc.l 0
  856. sizeOfUserData dc.l 0
  857. typeOfData     dc.w 0
  858.  
  859.  
  860. ATAKptr        dc.l 0
  861. RLSEptr        dc.l 0
  862.  
  863. ; For 10 waves
  864. SampleInfo0 dc.l 0 ;oneShot Start
  865.             dc.l 0 ;byte offset to loopStart
  866.             dc.l 0 ;byte offset to loopEnd (from wave beginning)
  867. SampleInfo1 dc.l 0
  868.             dc.l 0
  869.             dc.l 0
  870. SampleInfo2 dc.l 0
  871.             dc.l 0
  872.             dc.l 0
  873. SampleInfo3 dc.l 0
  874.             dc.l 0
  875.             dc.l 0
  876. SampleInfo4 dc.l 0
  877.             dc.l 0
  878.             dc.l 0
  879. SampleInfo5 dc.l 0
  880.             dc.l 0
  881.             dc.l 0
  882. SampleInfo6 dc.l 0
  883.             dc.l 0
  884.             dc.l 0
  885. SampleInfo7 dc.l 0
  886.             dc.l 0
  887.             dc.l 0
  888. SampleInfo8 dc.l 0
  889.             dc.l 0
  890.             dc.l 0
  891. SampleInfo9 dc.l 0
  892.             dc.l 0
  893.             dc.l 0
  894.  
  895.   XDEF SAMPext,Same,NoMem,ReadErr,WriteErr,Not8SVX,Cancel,CantFind
  896.   XDEF CantCreate,Quit,LibErr,Success,_BUFFER,Directions
  897.  
  898. SAMPext        dc.b  '.SAMP',0
  899. Same           dc.b  'Would you like to save this SAMP file as',0
  900. NoMem          dc.b  'No memory for copy buffer.',0
  901. ReadErr        dc.b  'A read error occurred.',0
  902. WriteErr       dc.b  'A write error occurred.',0
  903. Not8SVX        dc.b  'Not an IFF 8SVX file',0
  904. Cancel         dc.b  'Conversion canceled',0
  905. CantFind       dc.b  'Cannot find the source file.',0
  906. CantCreate     dc.b  'Cannot create the destination file.',0
  907. WINTITLE       dc.b  '8SVX to SAMP Conversion  ® 1989  dissidents',0
  908. Quit           dc.b  1
  909. LibErr         dc.b  'FileIO library failure',0
  910. Success        dc.b  '8SVX file successfully converted.',0
  911.  
  912.  ; Use the following string area for filename buffer
  913. _BUFFER:
  914. GfxName        dc.b  'graphics.library',0
  915. IntuitionName  dc.b  'intuition.library',0
  916. RequesterName  dc.b  'requester.library',0
  917. FileReqErr     dc.b  'Cannot find the "requester.library"',0
  918. IOerR          dc.b  'Cannot get a FileIO structure.',0
  919. Click          dc.b  'Click mouse for file selection or CLOSEWINDOW.',0
  920. FONTNAME       dc.b  'topaz.font',0
  921. Directions:
  922.  dc.b 'This program will convert an IFF 8SVX sampled sound file to the SAMP',0 
  923.  dc.b 'format. It requires the FileIO library in the libs drawer of your boot',0
  924.  dc.b 'disk. Click the mouse select button to begin filename selection, or',0
  925.  dc.b 'click on the CLOSE gadget to exit. Select the name of the 8SVX file to',0
  926.  dc.b 'be converted via the FileIO requester, then select OK. If the file is',0
  927.  dc.b 'successfully loaded and converted, you will be prompted to save the',0
  928.  dc.b 'new SAMP file in the same directory with a .SAMP extention added. You',0
  929.  dc.b 'may otherwise choose to enter a new name via the FileIO string gadgets.',0
  930.  dc.b 'If the SAMP file is successfully saved, a requester will indicate so.',0
  931.  dc.b 'This program was written by Jeff Glatt of dissidents.',0
  932. Family:
  933.  dc.b 'Press one of the following keys for the instrument family',0
  934.  dc.b ' ',0
  935.  dc.b 'Q = String',0
  936.  dc.b 'W = Woodwind',0
  937.  dc.b 'E = Keyboard',0
  938.  dc.b 'R = Guitar',0
  939.  dc.b 'T = Voice',0
  940.  dc.b 'Y = Drum1',0
  941.  dc.b 'U = Drum2',0
  942.  dc.b 'I = Percussion1',0
  943.  dc.b 'O = Brass1',0
  944.  dc.b 'P = Brass2',0
  945.  dc.b 'A = Cymbal',0
  946.  dc.b 'S = Effect1',0
  947.  dc.b 'D = Effect2',0
  948.  dc.b 'F = Synth',0
  949.  dc.b 'Hit RETURN for Unknown',0
  950. SPACES:
  951.  dc.b '                                                                        ',0
  952.  
  953.  CNOP 0,2
  954. TYPES dc.l STRING,WOOD,KEY,GUIT,VOICE,DR1,DR2,PER1,BRASS1,BRASS2
  955.       dc.l CYMBAL,EFF1,EFF2,SYNTH
  956. STRING: dc.b 15-1
  957.  dc.b 'Q = Violin bowed',0
  958.  dc.b 'W = Violin pluck',0
  959.  dc.b 'E = Violin Glissando',0
  960.  dc.b 'R = Violin tremulo',0
  961.  dc.b 'T = Viola bow',0
  962.  dc.b 'Y = Viola pluck',0
  963.  dc.b 'U = Viola glis.',0
  964.  dc.b 'I = Viola trem.',0
  965.  dc.b 'O = Cello bow',0
  966.  dc.b 'P = Cello pluck',0
  967.  dc.b 'A = Cello glis.',0
  968.  dc.b 'S = Cello trem.',0
  969.  dc.b 'D = Bass bowed',0
  970.  dc.b 'F = Bass pluck (jazz bass)',0
  971.  dc.b 'G = Bass trem.',0
  972. BRASS1 dc.b 14-1
  973.  dc.b 'Q = Baritone sax',0
  974.  dc.b 'W = Bari Growl',0
  975.  dc.b 'E = Tenor Sax',0
  976.  dc.b 'R = Tenor Growl',0
  977.  dc.b 'T = Alto Sax',0
  978.  dc.b 'Y = Alto Growl',0
  979.  dc.b 'U = Soprano sax',0
  980.  dc.b 'I = Soprano Growl',0
  981.  dc.b 'O = Trumpet',0
  982.  dc.b 'P = Muted Trumpet',0
  983.  dc.b 'A = Trumpet Drop',0
  984.  dc.b 'S = Trombone',0
  985.  dc.b 'D = Trombone slide',0
  986.  dc.b 'F = Trombone Mute',0
  987. BRASS2: dc.b 4-1
  988.  dc.b 'Q = French Horn',0
  989.  dc.b 'W = Tuba',0
  990.  dc.b 'E = Flugal Horn',0
  991.  dc.b 'R = English Horn',0
  992. WOOD: dc.b 9-1
  993.  dc.b 'Q = Clarinet',0
  994.  dc.b 'W = Flute',0
  995.  dc.b 'E = Pan Flute',0
  996.  dc.b 'R = Oboe',0
  997.  dc.b 'T = Piccolo',0
  998.  dc.b 'Y = Recorder',0
  999.  dc.b 'U = Basson',0
  1000.  dc.b 'I = Bass Clarinet',0
  1001.  dc.b 'O = Harmonica',0
  1002. KEY: dc.b 10-1
  1003.  dc.b 'Q = Grand Piano',0
  1004.  dc.b 'W = Elec. Piano',0
  1005.  dc.b 'E = HonkyTonk Piano',0
  1006.  dc.b 'R = Toy Piano',0
  1007.  dc.b 'T = Harpsichord',0
  1008.  dc.b 'Y = Clavinet',0
  1009.  dc.b 'U = Pipe Organ',0
  1010.  dc.b 'I = Hammond B-3',0
  1011.  dc.b 'O = Farfisa Organ',0
  1012.  dc.b 'P = Harp',0
  1013. DR1: dc.b 15-1
  1014.  dc.b 'Q = Kick',0
  1015.  dc.b 'W = Snare',0
  1016.  dc.b 'E = Tom',0
  1017.  dc.b 'R = Timbales',0
  1018.  dc.b 'T = Conga Hit',0
  1019.  dc.b 'Y = Conga Slap',0
  1020.  dc.b 'U = Brush Snare',0
  1021.  dc.b 'I = Elec. Snare',0
  1022.  dc.b 'O = Elec. Kick',0
  1023.  dc.b 'P = Elec. Tom',0
  1024.  dc.b 'A = RimShot',0
  1025.  dc.b 'S = Cross Stick',0
  1026.  dc.b 'D = Bongo',0
  1027.  dc.b 'F = Steel Drum',0
  1028.  dc.b 'G = Double Tom',0
  1029. DR2: dc.b 3-1
  1030.  dc.b 'Q = Timbani',0
  1031.  dc.b 'W = Timpani Roll',0
  1032.  dc.b 'E = Log Drum',0
  1033. PER1: dc.b 12-1
  1034.  dc.b 'Q = Block',0
  1035.  dc.b 'W = Cowbell',0
  1036.  dc.b 'E = Triangle',0
  1037.  dc.b 'R = Tambourine',0
  1038.  dc.b 'T = Whistle',0
  1039.  dc.b 'Y = Maracas',0
  1040.  dc.b 'U = Bell',0
  1041.  dc.b 'I = Vibes',0
  1042.  dc.b 'O = Marimba',0
  1043.  dc.b 'P = Xylophone',0
  1044.  dc.b 'A = Tubular Bells',0
  1045.  dc.b 'S = Glockenspeil',0
  1046. CYMBAL: dc.b 10-1
  1047.  dc.b 'Q = Closed Hihat',0
  1048.  dc.b 'W = Open Hihat',0
  1049.  dc.b 'E = Step Hihat',0
  1050.  dc.b 'R = Ride',0
  1051.  dc.b 'T = Bell Cymbal',0
  1052.  dc.b 'Y = Crash',0
  1053.  dc.b 'U = Choke Crash ',0
  1054.  dc.b 'I = Gong',0
  1055.  dc.b 'O = Bell Tree',0
  1056.  dc.b 'P = Cymbal Roll',0
  1057. GUIT: dc.b 15-1
  1058.  dc.b 'Q = Electric',0
  1059.  dc.b 'W = Muted Electric',0
  1060.  dc.b 'E = Distorted',0
  1061.  dc.b 'R = Acoustic',0
  1062.  dc.b 'T = 12-String',0
  1063.  dc.b 'Y = Nylon String',0
  1064.  dc.b 'U = Power Chord',0
  1065.  dc.b 'I = Harmonics',0
  1066.  dc.b 'O = Chord Strum',0
  1067.  dc.b 'P = Banjo',0
  1068.  dc.b 'A = Elec. Bass',0
  1069.  dc.b 'S = Slapped Bass',0
  1070.  dc.b 'D = Popped Bass',0
  1071.  dc.b 'F = Sitar',0
  1072.  dc.b 'G = Mandolin',0
  1073. VOICE: dc.b 7-1
  1074.  dc.b 'Q = Male Ahh',0
  1075.  dc.b 'W = Female Ahh',0
  1076.  dc.b 'E = Male OOO',0
  1077.  dc.b 'R = Female OOO',0
  1078.  dc.b 'T = Female Breathy',0
  1079.  dc.b 'Y = Laugh',0
  1080.  dc.b 'U = Whistle',0
  1081. EFF1: dc.b 15-1
  1082.  dc.b 'Q = Explosion',0
  1083.  dc.b 'W = Gunshot',0
  1084.  dc.b 'E = Creaking Door Open',0
  1085.  dc.b 'R = Door Slam',0
  1086.  dc.b 'T = Door Close',0
  1087.  dc.b 'Y = Spacegun',0
  1088.  dc.b 'U = Jet Engine',0
  1089.  dc.b 'I = Propeller',0
  1090.  dc.b 'O = Helocopter',0
  1091.  dc.b 'P = Broken Glass',0
  1092.  dc.b 'A = Thunder',0
  1093.  dc.b 'S = Rain',0
  1094.  dc.b 'D = Birds',0
  1095.  dc.b 'F = Jungle Noises',0
  1096.  dc.b 'G = Footstep',0
  1097. EFF2: dc.b 15-1
  1098.  dc.b 'Q = Machine Gun',0
  1099.  dc.b 'W = Telephone',0
  1100.  dc.b 'E = Dog bark',0
  1101.  dc.b 'R = Dog Growl',0
  1102.  dc.b 'T = Boat Whistle',0
  1103.  dc.b 'Y = Ocean',0
  1104.  dc.b 'U = Wind',0
  1105.  dc.b 'I = Crowd Boos',0
  1106.  dc.b 'O = Applause',0
  1107.  dc.b 'P = Roaring Crowds',0
  1108.  dc.b 'A = Scream',0
  1109.  dc.b 'S = Sword Clash',0
  1110.  dc.b 'D = Avalance',0
  1111.  dc.b 'F = Bouncing Ball',0
  1112.  dc.b 'G = Ball against bat or club',0
  1113. SYNTH dc.b 6-1
  1114.  dc.b 'Q = Strings',0
  1115.  dc.b 'W = Square',0
  1116.  dc.b 'E = Sawtooth',0
  1117.  dc.b 'R = Triangle',0
  1118.  dc.b 'T = Sine',0
  1119.  dc.b 'Y = Noise',0
  1120. NumOfChoices dc.b 0
  1121.